package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ruoyi.system.mapper.AdminVideoMapper;
import com.ruoyi.system.domain.AdminVideo;
import com.ruoyi.system.service.IAdminVideoService;
import com.ruoyi.common.core.text.Convert;

/**
 * 视频Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-06-17
 */
@Service
public class AdminVideoServiceImpl implements IAdminVideoService 
{
    @Autowired
    private AdminVideoMapper adminVideoMapper;

    /**
     * 查询视频
     * 
     * @param videoId 视频ID
     * @return 视频
     */
    @Override
    public AdminVideo selectAdminVideoById(Long videoId)
    {
        return adminVideoMapper.selectAdminVideoById(videoId);
    }

    /**
     * 查询视频列表
     * 
     * @param adminVideo 视频
     * @return 视频
     */
    @Override
    public List<AdminVideo> selectAdminVideoList(AdminVideo adminVideo)
    {
        return adminVideoMapper.selectAdminVideoList(adminVideo);
    }

    /**
     * 新增视频
     * 
     * @param adminVideo 视频
     * @return 结果
     */
    @Override
    public int insertAdminVideo(AdminVideo adminVideo)
    {
        adminVideo.setCreateTime(DateUtils.getNowDate());
        return adminVideoMapper.insertAdminVideo(adminVideo);
    }

    /**
     * 修改视频
     * 
     * @param adminVideo 视频
     * @return 结果
     */
    @Override
    public int updateAdminVideo(AdminVideo adminVideo)
    {
        adminVideo.setUpdateTime(DateUtils.getNowDate());
        return adminVideoMapper.updateAdminVideo(adminVideo);
    }

    /**
     * 删除视频对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAdminVideoByIds(String ids)
    {
        return adminVideoMapper.deleteAdminVideoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除视频信息
     * 
     * @param videoId 视频ID
     * @return 结果
     */
    @Override
    public int deleteAdminVideoById(Long videoId)
    {
        return adminVideoMapper.deleteAdminVideoById(videoId);
    }
    
    /**
     * 视频状态修改
     * 
     * @param video 视频信息
     * @return 结果
     */
    @Override
    public int changeStatus(AdminVideo adminVideo)
    {
        return adminVideoMapper.updateAdminVideo(adminVideo);
    }
}
